/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author LYS
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../../model/baseModel';
import { UploadApiResult } from '../../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface YfRouteDriverPlan extends BasicModel<YfRouteDriverPlan> {
  ddate?: string; // 分派日期
  routeCode?: string; // 线路
  driver?: string; // 驾驶员
  driver2?: string; // 押运员
  carNo?: string; // 车牌号
}

export const yfRouteDriverPlanList = (params?: YfRouteDriverPlan | any) =>
  defHttp.get<YfRouteDriverPlan>({ url: adminPath + '/bus/plan/yfRouteDriverPlan/list', params });

export const yfRouteDriverPlanListData = (params?: YfRouteDriverPlan | any) =>
  defHttp.post<Page<YfRouteDriverPlan>>({
    url: adminPath + '/bus/plan/yfRouteDriverPlan/listData',
    params,
  });

export const yfRouteDriverPlanForm = (params?: YfRouteDriverPlan | any) =>
  defHttp.get<YfRouteDriverPlan>({ url: adminPath + '/bus/plan/yfRouteDriverPlan/form', params });

export const yfRouteDriverPlanSave = (params?: any, data?: YfRouteDriverPlan | any) =>
  defHttp.postJson<YfRouteDriverPlan>({
    url: adminPath + '/bus/plan/yfRouteDriverPlan/save',
    params,
    data,
  });

export const yfRouteDriverPlanImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/bus/plan/yfRouteDriverPlan/importData',
      onUploadProgress,
    },
    params,
  );

export const yfRouteDriverPlanDeleteBatch = (params?: YfRouteDriverPlan | any) =>
  defHttp.get<YfRouteDriverPlan>({
    url: adminPath + '/bus/plan/yfRouteDriverPlan/deleteBatch',
    params,
  });
